package com.tender;

import com.tender.tools.EncodesUtil;

import org.junit.Test;

public class EncodesUtilTest {
    /**
     * @Description 测试16进制编码
     */
    @Test
    public void testHex(){
        String val = "hello";
        String afterEncodeHex = EncodesUtil.encodeHex(val.getBytes());
        System.out.println("16进制字符串：" + afterEncodeHex);
        String valHandler = new String(EncodesUtil.decodeHex(afterEncodeHex));
        System.out.println("比较结果："+val.equals(valHandler));
    }

    /**
     * @Description 测试base64编码
     */
    @Test
    public void testBase64(){
        String val = "hello";
        String afterBase64 = EncodesUtil.encodeBase64(val.getBytes());
        System.out.println("base64 字符串：" + afterBase64);
        String valHandler = new String(EncodesUtil.decodeBase64(afterBase64));
        System.out.println("比较结果："+val.equals(valHandler));
    }

}
